package com.wen.big_event.mapper;

import com.wen.big_event.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    //通过用户名查询全部
    @Select("select * from user where username = #{username}")
     User findByUserName(String username);

    //注册：插入用户名和密码进user表
    @Insert("insert into user(username,password,create_time,update_time)" +
            " values(#{username},#{password},now(),now())")
     void add(String username, String password);

    //更新数据通过我们传进来的User对象
    @Update("update user set nickname=#{nickname},email=#{email},update_time=#{updateTime} where id=#{id}")
    void updata(User user);
}
